<template>
  <view>
    <!-- 公共组件-每个页面必须引入 -->
    <public-module></public-module>
<u-empty text="请先登陆" mode="data"  icon="https://i.yodin.com/storage/empty/permission.png" v-if="!hasLogin"></u-empty>
<view v-else>

      <u-empty text="你还未任何发布信息" mode="data" icon="https://i.yodin.com/storage/empty/data.png"  :show="flow_list.length === 0" v-if="loadstatus == false"></u-empty>
      <view class="u-padding-20" v-if="flow_list.length > 0">

        <view class="base-panel-box u-m-b-30">
          <view class="item" v-for="(item, index) in flow_list" :key="index">
            <u-row gutter="0" justify="space-between">
              <u-col span="9">
				<view class="u-font-sm u-type-info"> {{ item.name }}</view>
			  </u-col >
              <u-col span="3" textAlign="center">
				<view class="u-p-l-10">
					<u-button size="mini" type="primary"
					@click="$tools.goJump('/pagesPackageA/info/fabu',{content_id:item.content_id},!userInfo.token,'')">修改
					</u-button>
				</view>
              </u-col>
			</u-row>

			<u-gap height="10"></u-gap>


          </view>
        </view>
      </view>
      <view v-if="flow_list.length > 0">
        <u-loadmore :status="loadStatus" @loadmore="get_info"></u-loadmore>
      </view>

</view>

  </view>
</template>


<script>
import { mapState, mapMutations } from "vuex";
import { api_content_list } from '@/config/api.js';
export default {
  data() {
    return {
      flow_list: [],
      hasLogin: false,
      loadStatus: "loadmore",
      loadstatus: false,
      loadstxt: "loading...",
      page: 1,
    };
  },
  computed: {
    ...mapState(['PrimaryColor','userInfo','siteInfo']),
  },
  onReachBottom() {
  	this.loadStatus = 'loading';
  	setTimeout(() => {
		this.get_info();
  		this.loadStatus = 'loadmore';
  	}, 50);
  },
  onLoad(options) {
		this.hasLogin=this.userInfo.token;
		if (!this.hasLogin){return;}
		// let query = JSON.parse(decodeURIComponent(options.query));
		// if (query.entertabid>0){
		// 	this.tabscurrent = query.entertabid;
		// }
		this.get_info();
  },

  methods: {

    get_info() {
      return new Promise((resolve, reject) => {
        this.loadstatus = true;
        api_content_list({
          page: this.page,
          limit: 10,
          see_users_id: this.userInfo.member_id,
        }).then((res) => {
            console.log(res);
            this.loadstatus = false;
            if (res.count > 0) {
                if (this.page <= res.pages) {
					res.list.map((item) => {
						this.flow_list.push(item);
					})
					if (this.page==res.pages)this.loadStatus = "nomore";
                  this.page += 1;
                } else {
                  this.loadStatus = "nomore";
                }
            }
          }).catch((e) => {
            this.loadstatus = false;
            resolve(false);
          });
      });
    },

	
  },
};
</script>
<style lang="scss" scoped>
</style>
